package com.alesj.newsfeed.web;

import com.alesj.newsfeed.data.Contact;
import com.generalynx.ecos.web.controller.ExceptionMultiActionController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author <a href="mailto:ales.justin@gmail.com">Ales Justin</a>
 */
public class ExportController extends ExceptionMultiActionController {

    private String exportView = "csvView";

    /**
     * Export contacts
     */
    public ModelAndView exportHandler(HttpServletRequest request, HttpServletResponse response) throws Exception {
        return new ModelAndView(exportView, "elements", getBasicDAO().findEntity(Contact.class));
    }

    public void setExportView(String exportView) {
        this.exportView = exportView;
    }

}
